package com.tarena.lbs.business.warm;


import com.tarena.lbs.business.servcie.StoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Order(0)
public class StoreLocationWarmup implements ApplicationRunner {

    @Autowired
    private StoreService storeService;
    /**
     * Bean 生命周期
     * 1.实例化对象
     * 2.初始化方法
     * 3.属性值注入
     * 4.保存在容器中
     * 5.容器启动，执行所有的run方法
     * 6.容器关闭 destroy
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("缓存店铺地理位置的预热开始执行！");
        storeService.startOnceWarmup();
    }
}
